<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 数组的增删改查

        var numArr = [1, 3, 2, 8, 5];

        // 增加元素
        numArr[5] = "121";
        console.log(numArr);

        // 修改元素
        numArr[0] = "21";
        console.log(numArr);

        // 查看元素
        console.log(numArr[0]);
        var item = numArr[2];
        console.log(item);


        // 删除元素
        // numArr[1] = null ; 这不是删除
        // splice (从那个索引开始,删除几个元素)
        numArr.splice(0,5);
        console.log(numArr);
    </script>
</body>

</html>